<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>css图片轮播效果</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: pink;
        }

        .main {
            position: relative;
            width: 600px;
            height: 400px;
            overflow: hidden;
            border-radius: 5px;
        }

        .item {
            position: absolute;
            top: 0;
            width: 100%;
            height: 100%;
            transition: all 0.5s;
            background-size: cover;
        }

        .item1 {
            background-image: url(./images/picture_album01.jpg);
        }

        .item2 {
            background-image: url(./images/picture_album02.jpeg);
            left: 100%;
        }

        .item3 {
            background-image: url(./images/picture_album03.jpg);
            left: 200%;
        }

        input {
            position: relative;
            z-index: 100;
            display: none; 
        }

        .select {
            position: absolute;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);
            width: 60px;
            height: 10px;
            z-index: 1;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .select>label {
            width: 10px;
            height: 10px;
            background-color: rgb(255, 255, 255);
            border-radius: 50%;
            cursor: pointer;
            border: 1.5px solid white;
        }

        .main input:nth-of-type(1):checked~.select label:nth-of-type(1) {
            background-color: rgb(236, 119, 77);
        }

        .main input:nth-of-type(2):checked~.select label:nth-of-type(2) {
            background-color: rgb(244, 160, 174);
        }

        .main input:nth-of-type(3):checked~.select label:nth-of-type(3) {
            background-color: rgb(153, 209, 232);
        }

        .main input:nth-of-type(1):checked~.item {
            transform: translateX(0);
        }

        .main input:nth-of-type(2):checked~.item {
            transform: translateX(-100%);
        }

        .main input:nth-of-type(3):checked~.item {
            transform: translateX(-200%);
        }
    </style>
</head>

<body>
    <!--  底层盒子 -->
    <div class="main">
        <!-- 三个单选按钮，先默认选择第一个 -->
        <input type="radio" name="choose" id="choose1" checked>
        <input type="radio" name="choose" id="choose2">
        <input type="radio" name="choose" id="choose3">
        <!-- 放三张图片，用背景图片表示 -->
        <div class="item item1"></div>
        <div class="item item2"></div>
        <div class="item item3"></div>
        <!-- 三个label标签 -->
        <span class="select">
            <label for="choose1"></label>
            <label for="choose2"></label>
            <label for="choose3"></label>
        </span>
    </div>
</body>

</html>